import { PrizeFallHintBtn } from "../PrizeFall/PrizeFallHintBtn";
import { ObjCreate } from "../common/ObjCreate";
import { GlobalStyle } from "../../../common/global/GlobalStyle";
import { SecTimer } from "../../../../com/gengine/core/frame/SecTimer";
import { TimerType } from "../../../../com/gengine/core/frame/TimerType";
import { RemainTimeTool } from "../award/RemainTimeTool";
import { Language } from "../../../../extend/language/Language";
import { Dispatcher } from "../../../mvc/core/Dispatcher";
import { DataEvent } from "../../events/DataEvent";
import { EventName } from "../../mvc/EventName";
import { GTextFiled } from "../../../../com/mui/controls/GTextFiled";
type int = number;
//class PrizeFallHintTimeBtn
    
    export  class PrizeFallHintTimeBtn extends PrizeFallHintBtn
    {
        constructor()
        {
            super();
            this.createTxt();
            return;
        }

        /* internal  */createTxt(): void
        {
            this._timeTxt = ObjCreate.createGTextField("", 0, 50, 60, 20, this, GlobalStyle.textFormatRed);
            return;
        }

        public setTime(arg1: int): void
        {
            if (this._secTimer != null) 
            {
                this._secTimer.repeatCount = arg1;
            }
            else 
            {
                this._secTimer = new SecTimer(1, arg1);
                this._secTimer.addListener(TimerType.ENTERFRAME, this.onTimerHandler);
                this._secTimer.addListener(TimerType.COMPLETE, this.onCompleteHandler);
            }
            this._secTimer.start();
            return;
        }

        /* internal  */onTimerHandler(arg1: SecTimer): void
        {
            this._timeTxt.htmlText = RemainTimeTool.getRemainTimeBySeconds(arg1.repeatCount);
            return;
        }

        /* internal  */onCompleteHandler(arg1: SecTimer): void
        {
            arg1.stop();
            arg1.isDelete = false;
            this.hide();
            return;
        }

        protected /* override */ onPrizeFallClick(arg1: Object /* flash.events.MouseEvent */): void
        {
            var loc1=Language.getString(70761);
            Dispatcher.dispatchEvent(new DataEvent(EventName.PrizeFallShowModule, loc1));
            return;
        }

        /* internal */ /* var */_secTimer: SecTimer;

        /* internal */ /* var */_timeTxt: GTextFiled;
    }
